package com.wenlong.service.impl;

import com.wenlong.dao.UserDao;
import com.wenlong.dao.impl.UserDaoImpl;
import com.wenlong.pojo.User;
import com.wenlong.service.UserService;

/**
 * @author 苏文龙
 * @version 1.0
 */
public class UserServiceImpl implements UserService {
    UserDao userDao = new UserDaoImpl();
    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserByUsernameAndPassword(user.getUsername(),user.getPassword());
    }

    @Override
    public boolean exitsUser(String username) {
        return userDao.queryUserByUsername(username) != null?true:false;
    }
}
